package com.yw.smartcityforjava.utils;

import android.content.Context;
import android.content.SharedPreferences;

import com.yw.smartcityforjava.App;

public class SPUtils {

    public static class Key{
        public static String SHOW_GUIDE = "show_guide";

    }

    private static SPUtils instance = new SPUtils();
    public static SPUtils getInstance(){
        return instance;
    }

    private SharedPreferences sp;

    private SPUtils(){
        sp = App.app.getSharedPreferences("smart_city", Context.MODE_PRIVATE);
    }

    public void saveString(String key, String value){
        sp.edit().putString(key, value).apply();
    }
    public String getString(String key){
        return sp.getString(key,"");
    }

    public void saveBoolean(String key, Boolean value){
        sp.edit().putBoolean(key, value).apply();
    }
    public Boolean getBoolean(String key, boolean defValue){
        return sp.getBoolean(key,defValue);
    }

}
